/**
 * 
 */
package br.com.fatesg.www.teste;

import org.hibernate.Session;

import junit.framework.TestCase;
import br.com.fatesg.www.dao.DAO;
import br.com.fatesg.www.dao.IndustriaDAO;
import br.com.fatesg.www.dao.ResiduoDAO;
import br.com.fatesg.www.entidade.Industria;
import br.com.fatesg.www.entidade.Residuo;
import br.com.fatesg.www.util.HibernateUtil;

/**
 * @author eder
 * 
 */
public class ResiduoTeste extends TestCase {

	Session session = HibernateUtil.getSessionFactory().openSession();

	DAO<Residuo, Long> residuoDAO = new ResiduoDAO(session);
	DAO<Industria, Long> industriaDAO = new IndustriaDAO(session);

	public void testarInclusao() {
		try {
			Residuo residuo = new Residuo();

			residuo.setDescricao("Raspa de niqueo");
			residuo.setOperacao(1);
			residuo.setQuantidade(200);
			residuo.setTipo("Kilos");
			residuo.setValor(300.0);
			residuo.setIndustria(industriaDAO.obterPeloId(Industria.class, 2213l));

			assertEquals("Residuo id: ", new Long(1), residuoDAO.salvar(residuo));
		} catch (Exception e) {

		}
	}

}
